<template>
<view>
<view v-if="carList.length>0">
    <view class="modle_border">
        <view v-for="(item, index) in carList" :key="index" class="modle_view">
            <view class="modle_jiantou"></view>
            <view class="modle_dian"></view>
            <view class="modle_view_title">时间：{{item.time}}</view>
            <view class="modle_view_name">昵称：{{item.nickname}}</view>
            <view :class="'modle_view_text  ' + (item.length==3?'modle_view_text_overflow':'')">{{item.content}}</view>
            <view @tap="open" class="modle_view_more" :data-index="index" v-if="item.length==3">展开
                <image class="modle_view_more_img" src="/static/pages/image/lvsejtxx_btn.png"></image>
            </view>
            <view @tap="clone" class="modle_view_more" :data-index="index" v-if="item.length==4">收起
                <image class="modle_view_more_img" src="/static/pages/image/lvsejtxx_btn.png"></image>
            </view>
        </view>
    </view>
    <view class="zhezhao"></view>
</view>
<block v-else>
    <!--<import src="/pages/data_null/index.wxml"></import>-->
    <view>
        <block data-type="template" data-is="title" data-attr="title:title">
    <view class="zanwushuju_border">
        <image class="zanwushuju_border_img" src="/static/pages/image/none_message.png"></image>
        <view class="zanwushuju_border_title">{{'暂无收藏数据'}}</view>
    </view>
</block>
    </view>
</block>
</view>
</template>

<script>
function _toConsumableArray(t) {
  if (Array.isArray(t)) {
    for (var a = 0, r = Array(t.length); a < t.length; a++) r[a] = t[a];

    return r;
  }

  return Array.from(t);
}
var app = getApp();

export default {
  data() {
    return {
      leftid: 1,
      check_name: "",
      carList: [],
      show: !0,
      name: "",
      title: "暂无留言内容"
    };
  },

  components: {},
  props: {},
  onLoad: function (t) {
    this.listFun();
  },
  onReachBottom: function () {
    this.show && this.listFun();
  },
  methods: {
    listFun: function () {
      var l = this;
      console.log(wx.getStorageSync("uid")), app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          r: "home.index.wordList",
          car_uid: wx.getStorageSync("uid"),
          leftid: this.leftid++
        },
        cachetime: "0",
        success: function (t) {
          if (console.log(t.data), 0 < t.data.data.length) {
            var a;
            (a = l.carList).push.apply(a, _toConsumableArray(t.data.data));
            var r = !0,
                e = !1,
                i = void 0;

            try {
              for (var n, s = l.carList[Symbol.iterator](); !(r = (n = s.next()).done); r = !0) {
                var o = n.value,
                    c = 28 * o.content.length / 588;
                c < 3 ? o.length = 2 : 3 < c && (o.length = 3);
              }
            } catch (t) {
              e = !0, i = t;
            } finally {
              try {
                !r && s.return && s.return();
              } finally {
                if (e) throw i;
              }
            }

            l.setData({
              carList: l.carList
            });
          } else l.show = !1;
        }
      });
    },
    clone: function (t) {
      var a = app.globalData.getAttr(t, "index");
      this.carList[a].length = 3, this.setData({
        carList: this.carList
      });
    },
    open: function (t) {
      var a = app.globalData.getAttr(t, "index");
      this.carList[a].length = 4, this.setData({
        carList: this.carList
      });
    }
  }
};
</script>
<style>
@import "./liuyan.css";
</style>